package db;

import java.io.FileInputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Properties;

public class ConnectDB {
	private static  Connection conn;
	public static Connection getConnection(){
		try {
			String driver,url,user,password;
			
			FileInputStream fis = new FileInputStream("src/propertiesFile/database.properties");
			Properties prop = new Properties();
			prop.load(fis);
			driver = prop.getProperty("driver");
			url = prop.getProperty("url" );
			user = prop.getProperty("user");
			password = prop.getProperty("password");
			Class.forName(driver);
			conn = DriverManager.getConnection(url,user,password);
			return conn;
			
		}catch(Exception e){
			e.printStackTrace();
		}
		return null;
	}
}
